package create_thread;

/**
 * Created with IDEA
 * author:ju bai
 * Date:2021/4/25
 * Time:19:55
 * 创建线程方法 1-1 -- 继承Thread类
 **/
public class Thread1 {
    static class MyThread extends Thread {
        @Override
        public void run() {
            //线程执行任务
            System.out.println("线程名称"+Thread.currentThread().getName());
        }
    }

    public static void main(String[] args) {
        //创建线程
        Thread t1 = new MyThread();
        //运行新线程
        t1.start();
        System.out.println("当前线程名称（主线程）"+Thread.currentThread().getName());
    }
}
